﻿using System;

namespace ElevatorDispatching
{
    /// <summary>
    /// 轿内呼层信号
    /// </summary>
    public struct CallFloorSignal : ICallSignal
    {
        /// <summary>
        /// 发出呼层信号的轿厢 Id
        /// </summary>
        public int CageId { get; }

        /// <summary>
        /// 呼层信号所召唤的楼层 Id
        /// </summary>
        public int FloorId { get; }

        /// <summary>
        /// 呼层信号发出的时间点
        /// </summary>
        public DateTimeOffset Time { get; }

        /// <summary>
        /// 构造一个新的轿内呼层信号
        /// </summary>
        /// <param name="cageId">发出呼层信号的轿厢 Id</param>
        /// <param name="floorId">呼层信号所召唤的楼层 Id</param>
        /// <param name="time">呼层信号发出的时间点，为空时即为系统当前时间</param>
        public CallFloorSignal(int cageId, int floorId, DateTimeOffset? time = null)
        {
            CageId = cageId;
            FloorId = floorId;
            Time = time ?? DateTimeOffset.Now;
        }
    }
}
